import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
import { HandlerEnum } from '/@/layouts/default/setting/enum';
import { MenuModeEnum, MenuTypeEnum } from '/@/enums/menuEnum';
import { baseHandler } from '/@/layouts/default/setting/handler';

import { useMultipleTabSetting } from '/@/hooks/setting/useMultipleTabSetting';
const { setMultipleTabSetting } = useMultipleTabSetting();

/**
 * 设置导航栏是否显示
 * @param params 
 */
export function setBarStatus(visible: boolean, topMenu: boolean) {
  let obj = {}
  if (visible) {
    obj = {
      title: t('layout.setting.menuTypeSidebar'),
      mode: MenuModeEnum.INLINE,
      type: MenuTypeEnum.SIDEBAR,
    }
    baseHandler(HandlerEnum.HEADER_SHOW, true);
  } else {
    obj = {
      title: t('layout.setting.menuTypeTopMenu'),
      mode: MenuModeEnum.HORIZONTAL,
      type: MenuTypeEnum.TOP_MENU,
    }
    baseHandler(HandlerEnum.HEADER_SHOW, topMenu);
  }
  baseHandler(HandlerEnum.CHANGE_LAYOUT, obj);
}

/**
 * 设置是否显示顶部菜单
 * @param params 
 */
export function setMenu(showMenu: boolean) {
  setMultipleTabSetting({ show: showMenu });
}

/**
 * 设置主题色
 * @param params 
 */
export function setMainTheme(color: string) {
  // baseHandler(HandlerEnum.CHANGE_THEME_COLOR, color);
  baseHandler(HandlerEnum.MENU_THEME, color);

}